package com.itheima.d6_singleInstance;

/**
 * 目标：掌握懒汉式单例的写法。
 */
public class Test2 {
    public static void main(String[] args) {
        //使用懒汉方式，请设计一个老婆单例类
        Wife myWife = Wife.getMyWife();
        System.out.println("myWife = " + myWife);
        Wife myWife1 = Wife.getMyWife();
        Wife myWife2 = Wife.getMyWife();
        Wife myWife3 = Wife.getMyWife();
        Wife myWife4 = Wife.getMyWife();

        System.out.println("myWife1 = " + myWife1);
        System.out.println("myWife2 = " + myWife2);
        System.out.println("myWife3 = " + myWife3);
        System.out.println("myWife4 = " + myWife4);
    }
}
